﻿# 新建一个定时任务
# 定时任务名称(不能与已有的重复)
$taskName="collect_log"
# 执行文件的路径
$file="C:\Users\admin\Desktop\new"

# ----------------------------------------
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-file $file"
$trigger = New-ScheduledTaskTrigger -Daily -At 9am
Register-ScheduledTask collect_log -Action $action -Trigger $trigger
Get-ScheduledTaskInfo -TaskName collect_log

cmd /c pause